package com.atty.dms.dao.mapper;

import com.atty.dms.dao.entity.PreferenceDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

public interface PreferenceMapper extends BaseMapper<PreferenceDO> {
        /**
         * 根据用户ID查询偏好信息
         */
        @Select("SELECT * FROM preferences WHERE user_id = #{userId}")
        PreferenceDO getByUserId(@Param("userId") Long userId);


        /**
         * 根据用户ID查询偏好数据
         */
        @Select("SELECT schedule_type, cleanliness, is_smoker, accept_pets, study_in_dorm, social_level, floor_preference " +
                "FROM preferences WHERE user_id = #{userId}")
        Map<String, Object> getUserPreferencesByUserId(@Param("userId") Long userId);


}